#include <bits/stdc++.h>
using namespace std;
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
using ll = long long;
void solve()
{
    ll n;
    cin >> n;
    vector<ll> a(n + 2);
    for (ll i = 1; i <= n;i++)
    {
        cin >> a[i];
    }
    vector<ll> pre(2200);
    ll sum = 0;
    for (ll i = 1; i <= n;i++)
    {
        for (ll j = i + 1;j <= n; j++)
        {
            if(a[i]>a[j])
                sum++;
        }
    }

    ll l = 1, r = n,ans=sum;
    for (ll i = 1; i <= n;i++)
    {
        ll v = sum;
        for (ll j = i ; j <= n;j++)
        {
            if(a[i]>a[j])
                v--;
            if(a[i]<a[j])
                v++;
            if(v<ans||(v==ans&&j-i<r-l))
            {
                ans = v;
                l = i;
                r = j;
            }
        }
    }
    cout << l << " " << r << endl;
}
int main()
{
    int t = 1;
    cin >> t;
    while(t--)
    {
        solve();
    }
   return 0;
}
